package com.hc.com.testCalibration;

import com.hc.R;
import com.hc.R.layout;
import com.hc.R.menu;
import com.hc.activity.util.ActivityApplicationUtil;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class TestCalibrationActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		// 设置没有title
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_test_calibration);
		
		// 当前的activity加入到关闭集合中
		ActivityApplicationUtil.getInstance().addActivity(this);
		
		Button closeCalibrationButton  =  (Button) findViewById(R.id.closeTestCalibrationBtn);
		closeCalibrationButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				
				TestCalibrationService.closeTestCorrect(TestCalibrationActivity.this);
			}
		});
	}

	// 对返回按钮进行监听
	@Override
	public void onBackPressed() {
		new AlertDialog.Builder(this).setTitle("提示").setMessage("退出会结束校准 ，是否退出校准")
				.setPositiveButton("确定", new DialogInterface.OnClickListener() {

					@Override
					public void onClick(DialogInterface dialog, int which) {

						TestCalibrationService.closeTestCorrect(TestCalibrationActivity.this);
					}
				}).setNegativeButton("取消", null).create().show();
	}

}
